/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tesoreria.be;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Gilmar
 */
@Entity
@Table(name = "tes_tipo_cambio")
//@NamedQueries({@NamedQuery(name = "TipoCambio.findAll", query = "SELECT t FROM TipoCambio t"), @NamedQuery(name = "TipoCambio.findByTpcCodigo", query = "SELECT t FROM TipoCambio t WHERE t.tpcCodigo = :tpcCodigo"), @NamedQuery(name = "TipoCambio.findByTpcValor", query = "SELECT t FROM TipoCambio t WHERE t.tpcValor = :tpcValor"), @NamedQuery(name = "TipoCambio.findByTpcFecha", query = "SELECT t FROM TipoCambio t WHERE t.tpcFecha = :tpcFecha")})
public class TipoCambio implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "tpc_codigo", nullable = false)
    private Integer tpcCodigo;
    @Column(name = "tpc_valor", precision = 11, scale = 4)
    private Double tpcValor;
    @Column(name = "tpc_fecha")
    @Temporal(TemporalType.DATE)
    private Date tpcFecha;
    @JoinColumn(name = "tmo_codigoDefecto", referencedColumnName = "tmo_codigo")
    @ManyToOne(fetch = FetchType.LAZY)
    private TipoMoneda tmocodigoDefecto;
    @JoinColumn(name = "tmo_codigo", referencedColumnName = "tmo_codigo")
    @ManyToOne(fetch = FetchType.LAZY)
    private TipoMoneda tmoCodigo;

    public TipoCambio() {
    }

    public TipoCambio(Integer tpcCodigo) {
        this.tpcCodigo = tpcCodigo;
    }

    public Integer getTpcCodigo() {
        return tpcCodigo;
    }

    public void setTpcCodigo(Integer tpcCodigo) {
        this.tpcCodigo = tpcCodigo;
    }

    public Double getTpcValor() {
        return tpcValor;
    }

    public void setTpcValor(Double tpcValor) {
        this.tpcValor = tpcValor;
    }

    public Date getTpcFecha() {
        return tpcFecha;
    }

    public void setTpcFecha(Date tpcFecha) {
        this.tpcFecha = tpcFecha;
    }

    public TipoMoneda getTmocodigoDefecto() {
        return tmocodigoDefecto;
    }

    public void setTmocodigoDefecto(TipoMoneda tmocodigoDefecto) {
        this.tmocodigoDefecto = tmocodigoDefecto;
    }

    public TipoMoneda getTmoCodigo() {
        return tmoCodigo;
    }

    public void setTmoCodigo(TipoMoneda tmoCodigo) {
        this.tmoCodigo = tmoCodigo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tpcCodigo != null ? tpcCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoCambio)) {
            return false;
        }
        TipoCambio other = (TipoCambio) object;
        if ((this.tpcCodigo == null && other.tpcCodigo != null) || (this.tpcCodigo != null && !this.tpcCodigo.equals(other.tpcCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.cip.esymons.tesoreria.be.TipoCambio[tpcCodigo=" + tpcCodigo + "]";
    }

}
